const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    port: 9000,
    proxy: {
      '/api': {
        target: 'http://localhost:8091',
        changeOrigin: true,
        pathRewrite: {
          '^/api': ''
        }
      }
    },
    headers: {
      'Access-Control-Allow-Origin': '*',
      'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
      'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization'
    }
  },
  pages: {
    index: {
      entry: 'src/pages/page1/main.ts',  // 入口文件
      template: 'public/index.html', // 模板文件
      filename: 'index.html', // 输出文件名
      title: '商品预览'
    },
    page2: {
      entry: 'src/pages/page2/main.ts',  // 入口文件
      template: 'public/page2.html', // 模板文件
      filename: 'page2.html', // 输出文件名
      title: '购物车'
    }
  }
})
